import axios, { AxiosRequestConfig, AxiosResponse } from 'axios'

axios.defaults.baseURL = 'http://localhost:8080'

axios.interceptors.request.use((config:AxiosRequestConfig)=>{
    return config
})

axios.interceptors.response.use((response:AxiosResponse)=>{
    console.log(response,'----')
    if(response.data.code !=200){
        return Promise.reject(response.data.message)
    }
    return response.data
},err=>{
    return Promise.reject(err)
})

export default axios